;(self.webpackChunkmp_webgl = self.webpackChunkmp_webgl || []).push([
  [79],
  {
    32867: (e, i, t) => {
      "use strict"
      var r
      t.d(i, { Z: () => o }),
        (function (e) {
          ;(e[(e.None = 0)] = "None"),
            (e[(e.Queued = 1)] = "Queued"),
            (e[(e.ForceQueued = 2)] = "ForceQueued"),
            (e[(e.Downloading = 3)] = "Downloading"),
            (e[(e.Downloaded = 4)] = "Downloaded"),
            (e[(e.DownloadFailed = 5)] = "DownloadFailed")
        })(r || (r = {}))
      const o = r
    },
    27079: (e, i, t) => {
      "use strict"
      t.d(i, { I6: () => PriorityCriteria, at: () => TilePrioritizer })
      var r,
        o = t(2212),
        s = t(52586),
        a = t(14844),
        n = t(32867),
        u = t(19674),
        p = t(34369),
        h = t(37381),
        c = t(17486),
        l = t(51263),
        w = t(57051),
        S = t(48715),
        d = t(41862),
        D = t(12216),
        y = t(60771),
        f = t(94329),
        g = t(82088)
      !(function (e) {
        ;(e[(e.None = 0)] = "None"), (e[(e.DirectionalFOV = 1)] = "DirectionalFOV")
      })(r || (r = {}))
      class PriorityCriteria {
        constructor(e, i, t, r) {
          ;(this.cameraRot = new o.Quaternion()),
            (this.sweep = e),
            (this.cameraPosition = new o.Vector3().copy(i)),
            (this.cameraDir = new o.Vector3().copy(t)),
            (this.upcomingSweeps = r),
            (this.zoomingActive = !1)
        }
      }
      const T = (e, i, t = !1) => {
        let r = 0
        if (e && i) for (const o of i) (t && -1 !== e.indexOf(o)) || (e.push(o), r++)
        return r
      }
      class TilePrioritizer {
        constructor(e, i, t, r) {
          ;(this.panoQualityManager = e),
            (this.tilingSettings = i),
            (this.sweepData = t),
            (this.raycaster = r),
            (this.tempQueue = []),
            (this.filterAndPrioritize = (e, i, t) => {
              if (!this.priorityCriteria.sweep) return
              const r = void 0 !== this.priorityCriteria.upcomingSweeps && null !== this.priorityCriteria.upcomingSweeps,
                o = this.tempQueue
              ;(o.length = 0), this.queueTilesForPano(o, t, this.priorityCriteria.sweep, p.AB.BASE)
              const s = T(e, o, !0)
              ;(this.currViewQueue[p.SL.BASE].value = s),
                (this.fullPanoQueue[p.SL.BASE].value = s),
                r
                  ? this.queueForRestrictedSweeps(e, t)
                  : this.priorityCriteria.viewMode !== f.Ey.Panorama
                  ? this.queueForNonPanoViewmode(e, t)
                  : this.queueForPanoViewmode(e, i, t),
                this.tilingSettings.downloadFullPano && this.queueFullPano(e, t)
            }),
            (this.queueRaycast = (() => {
              const e = new o.Vector3()
              return (i, t) => {
                if (this.priorityCriteria.sweep)
                  if (this.priorityCriteria.hoveredSweep) this.queueTilesForPano(i, t, this.priorityCriteria.hoveredSweep, p.AB.BASE)
                  else if (this.raycaster && this.raycaster.hit) {
                    const r = e.copy(this.raycaster.hit.point).sub(this.priorityCriteria.sweep.position),
                      o = this.getSinglePanoInDirection(r),
                      s = this.sweepData.getSweep(o)
                    s && this.queueTilesForPano(i, t, s, p.AB.BASE)
                  }
              }
            })()),
            (this.queueRaycastIntersection = (e, i) => {
              if (!this.raycaster || !this.raycaster.hit) return
              const t = (0, g.bG)(this.sweepData, !1, this.raycaster.hit.intersection),
                r = t.length > 0 ? t[0].sweep : this.sweepData.getClosestSweep(this.raycaster.hit.point, !0)
              r && this.queueTilesForPano(e, i, r, p.AB.BASE)
            }),
            (this.getSweepIdInLocalDirection = (() => {
              const e = new o.Vector3()
              return i => {
                const t = this.priorityCriteria.cameraRot,
                  r = e.copy(i).applyQuaternion(t)
                return this.getSinglePanoInDirection(r)
              }
            })()),
            (this.persistentStorage = new c.a()),
            (this.maxResolution = e.getNavPanoSize()),
            (this.currViewQueue = F()),
            (this.fullPanoQueue = F()),
            (this.isMobileDevice = (0, y.tq)()),
            (this.priorityCriteria = new PriorityCriteria(null, new o.Vector3(0, 0, 0), new o.Vector3(0, 0, -1)))
        }
        getQualityQueueSize(e, i) {
          return e === d.v.CurrentView ? this.currViewQueue[i].value : this.fullPanoQueue[i].value
        }
        makeQueueSubscription(e, i, t) {
          return (e === d.v.CurrentView ? this.currViewQueue[i] : this.fullPanoQueue[i]).onChanged(t)
        }
        updateCriteria(e, i, t, r) {
          ;(this.priorityCriteria.sweep = e),
            this.priorityCriteria.cameraPosition.copy(i),
            this.priorityCriteria.cameraDir.copy(t),
            this.priorityCriteria.cameraRot.copy(r)
        }
        setHoveredSweep(e) {
          this.priorityCriteria.hoveredSweep = e
        }
        setUpcomingSweeps(e) {
          this.priorityCriteria.upcomingSweeps = e
        }
        clearUpcomingSweeps() {
          this.priorityCriteria.upcomingSweeps = void 0
        }
        setDownloadFOV(e) {
          TilePrioritizer.DIRECTIONAL_FOV = e
        }
        queueForRestrictedSweeps(e, i) {
          if (!this.priorityCriteria.upcomingSweeps) return
          let t = 0
          for (const r of this.priorityCriteria.upcomingSweeps) if ((t++, this.queueTilesForPano(e, i, r, p.AB.BASE), t >= 3)) break
          this.queueFOVStandardNarrow(e, i), this.queueFOVHighNarrow(e, i)
        }
        queueForPanoViewmode(e, i, t) {
          this.queueRaycast(e, t),
            this.queueFOVStandardNarrow(e, t),
            this.queueScoredSweeps(e, i, t),
            this.queueFOVHighNarrow(e, t),
            this.isMobileDevice || this.queueWASD(e, i, t)
        }
        queueForNonPanoViewmode(e, i) {
          this.queueRaycastIntersection(e, i)
        }
        queueFOVTiles(e, i, t, r) {
          if (!this.priorityCriteria.sweep) return 0
          const o = p.eE[i]
          return this.canDownloadSize(this.priorityCriteria.sweep, i)
            ? this.queueTilesInDirectionForPano(e, r, this.priorityCriteria.sweep, o, this.priorityCriteria.cameraDir, t)
            : 0
        }
        queueScoredSweeps(e, i, t) {
          if (this.priorityCriteria.sweep && this.maxResolution <= 2048) {
            const r = this.persistentStorage.getArray("filterAndPrioritize:scoredSweeps")
            this.populateScoredSweeps(this.priorityCriteria.sweep, i, r, this.priorityCriteria.cameraDir, 6), this.queueTilesForPanos(e, r, t, p.AB.BASE, 4)
          }
        }
        queueFOVStandardNarrow(e, i) {
          if (!this.priorityCriteria.sweep) return
          const t = this.tempQueue
          t.length = 0
          const r = this.queueFOVTiles(t, p.SL.STANDARD, TilePrioritizer.DIRECTIONAL_FOV, i)
          TilePrioritizer.sortTiles(t, this.priorityCriteria.sweep, this.priorityCriteria.cameraDir),
            T(e, t),
            (this.currViewQueue[p.SL.STANDARD].value = r),
            (this.fullPanoQueue[p.SL.STANDARD].value = r)
        }
        queueFOVHighNarrow(e, i) {
          if (!this.priorityCriteria.sweep) return
          const t = this.tempQueue
          t.length = 0
          const r = this.queueFOVTiles(t, p.SL.HIGH, TilePrioritizer.DIRECTIONAL_FOV, i),
            o = this.queueFOVTiles(t, p.SL.ULTRAHIGH, TilePrioritizer.DIRECTIONAL_FOV, i)
          TilePrioritizer.sortTiles(t, this.priorityCriteria.sweep, this.priorityCriteria.cameraDir),
            T(e, t),
            (this.currViewQueue[p.SL.HIGH].value = r),
            (this.currViewQueue[p.SL.ULTRAHIGH].value = o)
        }
        queueFullPano(e, i) {
          if (!this.priorityCriteria.sweep) return
          const t = this.tempQueue
          if (((t.length = 0), this.maxResolution <= p.AB.HIGH)) {
            if (this.canDownloadSize(this.priorityCriteria.sweep, p.SL.HIGH)) {
              const e = this.queueTilesForPano(t, i, this.priorityCriteria.sweep, p.AB.HIGH)
              this.fullPanoQueue[p.SL.HIGH].value = e
            }
          } else if (this.canDownloadSize(this.priorityCriteria.sweep, p.SL.ULTRAHIGH)) {
            const e = this.queueTilesForPano(t, i, this.priorityCriteria.sweep, p.AB.ULTRAHIGH)
            this.fullPanoQueue[p.SL.ULTRAHIGH].value = e
          }
          TilePrioritizer.sortTiles(t, this.priorityCriteria.sweep, this.priorityCriteria.cameraDir), T(e, t, !0)
        }
        queueWASD(e, i, t) {
          const r = this.persistentStorage.getArray("filterAndPrioritize:neighbors") || []
          if (((r.length = 0), !this.priorityCriteria.sweep)) return
          const o = [D.f.FORWARD, D.f.RIGHT, D.f.LEFT, D.f.BACK]
          for (const e of o) {
            const t = this.getSweepIdInLocalDirection(e),
              o = i.get(t)
            o && r.push(o)
          }
          this.queueTilesForPanos(e, r, t, p.AB.BASE)
        }
        canDownloadSize(e, i) {
          const t = p.eE[i],
            r = this.panoQualityManager.getNavPanoSize() >= t || (this.maxResolution >= t && this.panoQualityManager.getZoomPanoSize() >= t),
            o = this.panoQualityManager.getTestResults(e.id, i)
          return r && o === s.S.Untested && this.panoQualityManager.testDownload(e, i, a.I_), o === s.S.Success && r
        }
        populateScoredSweeps(e, i, t, r, s) {
          ;(t = t || []).length = 0
          const a = new o.Vector3().copy(e.position),
            n = [l._k(), l.ff(e), l.jN(a, 400), l.pI(a, r, 0.75)],
            u = [w.Dv(a, h.Xd.navigation.distanceFactor), w.o7(a, r, h.Xd.navigation.directionFactor)],
            p = this.sweepData.getSweepNeighbours(e),
            c = this.sweepData.sortByScore(n, u, p)
          for (let e = 0; e < c.length && e < s; e++) {
            const i = c[e].sweep
            t.push(i)
          }
        }
        queueTilesForPanos(e, i, t, r, o) {
          let s = 0
          for (const a of i) {
            if (((s += this.queueTilesForPano(e, t, a, r) > 0 ? 1 : 0), o && s >= o)) break
          }
          return s
        }
        queueTilesForPano(e, i, t, o) {
          const s = this.persistentStorage.get("queueTilesForSweep:filterCriteria", () => ({ filter: r.None }))
          return this.filterAndQueueTileDownloadDescriptors(e, i, t, o, s)
        }
        queueTilesInDirectionForPano(e, i, t, s, n, u) {
          const p = this.persistentStorage.get("queueTilesInDirectionForSweep:panoSpaceDir", () => new o.Vector3()),
            h = this.persistentStorage.get("queueTilesInDirectionForSweep:filterCriteria", () => ({
              filter: r.DirectionalFOV,
              direction: new o.Vector3(),
              fov: 60
            }))
          return p.copy(n), a.ym(t.rotation, p), h.direction.copy(p), (h.fov = u), this.filterAndQueueTileDownloadDescriptors(e, i, t, s, h)
        }
        filterAndQueueTileDownloadDescriptors(e, i, t, r, o) {
          const s = this.persistentStorage.getArray("filterAndQueueTileDownloadDescriptors:descriptors"),
            a = i.getTileDownloadDescriptors(t, r)
          ;(s.length = 0), this.filterTileDownloadDescriptors(a, s, o)
          let n = 0
          for (const i of s) i && (e.push(i), n++)
          return n
        }
        filterTileDownloadDescriptors(e, i, t) {
          let o, s
          switch (t.filter) {
            case r.DirectionalFOV:
              for (o = 0; o < e.length; o++) (s = e[o]), s && a.eO(s.panoSize, s.tileSize, s.face, s.tileX, s.tileY, t.direction, t.fov) && i.push(s)
              break
            default:
              for (o = 0; o < e.length; o++) (s = e[o]), i.push(s)
          }
          for (o = 0; o < i.length; o++) (s = i[o]), s && !this.canIncludeDescriptor(s) && (i[o] = null)
        }
        canIncludeDescriptor(e) {
          return e.status !== n.Z.Downloading && e.status !== n.Z.Downloaded
        }
        static sortTiles(e, i, t) {
          C.panoSpaceDir.copy(t), a.ym(i.rotation, C.panoSpaceDir), (C.fovThresholdNarrow = u.tf(TilePrioritizer.DIRECTIONAL_FOV)), e.sort(A)
        }
        static insertSortedPanoTile(e, i, t, r) {
          C.panoSpaceDir.copy(r), a.ym(t.rotation, C.panoSpaceDir), (C.fovThresholdNarrow = u.tf(TilePrioritizer.DIRECTIONAL_FOV))
          let o = -1
          for (let t = 0; t < e.length; t++) {
            if (A(i, e[t]) <= 0) {
              o = t
              break
            }
          }
          if (-1 === o) e[e.length] = i
          else {
            for (let i = e.length; i > o; i--) e[i] = e[i - 1]
            e[o] = i
          }
        }
        getSinglePanoInDirection(e) {
          const i = this.priorityCriteria.sweep
          if (!i) return ""
          const t = [l.ff(i), l._k(), l.pI(i.position, e)],
            r = [w.o7(i.position, e), w.TE(i.position)],
            o = i.neighbours
              .filter(e => {
                const i = this.sweepData.getSweep(e)
                return t.every(e => e(i))
              })
              .map(e => {
                const i = this.sweepData.getSweep(e)
                return { sweepId: e, score: r.reduce((e, t) => e + t(i), 0) }
              }),
            s = o.reduce((e, i) => (e.score > i.score ? e : i), o[0])
          return s ? s.sweepId : ""
        }
      }
      TilePrioritizer.DIRECTIONAL_FOV = 120
      const C = { panoSpaceDir: new o.Vector3(), fovThresholdNarrow: -1 },
        A = (e, i) => {
          const t = C.panoSpaceDir,
            r = C.fovThresholdNarrow,
            o = Math.max(Math.min(t.dot(e.direction), 1), -1),
            s = Math.max(Math.min(t.dot(i.direction), 1), -1)
          return o >= r && s < r ? -1 : (o < r && s >= r) || e.panoSize > i.panoSize ? 1 : i.panoSize > e.panoSize ? -1 : -(o - s)
        }
      function F() {
        return {
          [p.SL.BASE]: (0, S.Y)(0),
          [p.SL.STANDARD]: (0, S.Y)(0),
          [p.SL.HIGH]: (0, S.Y)(0),
          [p.SL.ULTRAHIGH]: (0, S.Y)(0)
        }
      }
    }
  }
])
